
package kaizone.haining.chaobohui.activity;

import kaizone.haining.chaobohui.R;
import kaizone.haining.chaobohui.fragment.GuideFragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.Window;

public class GuideActivity extends FragmentActivity {

    private FragmentManager mFragmentManager;

    private int mFlag;

    private Fragment mContent;

    @Override
    protected void onCreate(Bundle arg0) {
        super.onCreate(arg0);
        mFragmentManager = getSupportFragmentManager();

        Bundle bd = getIntent().getExtras();
        if (bd != null) {
            mFlag = bd.getInt(GuideFragment.FLAG_COME);
        }

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.content_frame);

        initContent();
    }

    private void initContent() {
        mContent = GuideFragment.newInstance(mFlag);
        mFragmentManager.beginTransaction().replace(R.id.content_frame, mContent).commit();
    }

    public static void come(Context context, int flagcome) {
        Bundle bd = new Bundle();
        bd.putInt(GuideFragment.FLAG_COME, flagcome);
        Intent intent = new Intent(context, GuideActivity.class);
        intent.putExtras(bd);
        context.startActivity(intent);
    }
}
